package com.scwatch.ext.domain;

import com.scwatch.core.domain.Site;
import com.scwatch.core.domain.User;
import com.scwatch.core.support.Siteable;

import javax.persistence.*;
import java.util.Date;

/**
 * app服务配置
 *
 * @author gjl
 *
 */
@Entity
@Table(name = "cms_app_service")
public class AppService implements java.io.Serializable,Siteable {
    private static final long serialVersionUID = 1L;


    private Integer id;

    /**
     * 服务地址
     */
    private String url;

    /**
     * 创建日期
     */
    private Date createDate;

    /**
     * 更新日期
     */
    private Date udpateDate;

    /**
     * 站点
     */
    private Site site;

    /**
     * 用户
     */
    private User user;

    /**
     * 是否发布 1，发布 2不发布
     */
    private String publish;

    /**
     * 服务描述
     */
    private String description;


    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "f_user_id")
    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "f_site_id", nullable = false)
    public Site getSite() {
        return site;
    }

    public void setSite(Site site) {
        this.site = site;
    }

    @Id
    @Column(name = "f_id", unique = true, nullable = false)
    @TableGenerator(name = "tg_cms_app_service", pkColumnValue = "cms_app_service", initialValue = 1, allocationSize = 10)
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "tg_cms_app_service")
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Column(name = "f_url", length =500)
    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "f_creation_date", nullable = false)
    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "f_update_date")
    public Date getUdpateDate() {
        return udpateDate;
    }

    public void setUdpateDate(Date udpateDate) {
        this.udpateDate = udpateDate;
    }

    @Column(name = "f_is_publish", length =2)
    public String getPublish() {
        return publish;
    }
    public void setPublish(String publish) {
        this.publish = publish;
    }

    @Column(name = "f_description", length =500)
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

}
